package demo2;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-09-09
 * Time:11:04
 */
class A1 {
    public A1() {
        fun();
        System.out.println("父类的构造方法");
    }
   public void fun(){

   }

}
class B extends A1 {
    private int name = 1;

    public B() {
        System.out.println("这是子类的构造方法");
    }

    @Override
    public void fun() {
        System.out.println("name:" + name);
    }
    //重写的方法也可以被重载
    public void fun(int a,int b){

    }
    public static void fun(int a,char b){
        System.out.println("int char");
    }
    public final void fun(int a,double b){
        System.out.println("int double");
    }
}
public class A {
    public static void main(String[] args) {

        B b = new B();
        b.fun(12,'A');
        b.fun(12,3.4);
    }

}